#pragma once

#include <iostream>
#include <fstream>
#include "3dsmaxsdk_preinclude.h"
#include "Max.h"
#include <vector>;
#include "IGame.h"

using namespace std;

class XmlWriterClass
{
public:
	XmlWriterClass(const char* fileName);
	void EndFile(void);
	~XmlWriterClass(void);
	void BeginWriteModels(void);
	void EndWriteModels(void);
	void BeginWriteModel(const char* modelName);
	void EndWriteModel(void);

	void WriteTransformation(Point3 translation, Point4 rotation, Point3 scale);

	void BeginWriteVertices(void);
	void EndWriteVertices(void);

	void WriteVertice(Point3 position, Point3 normal, Point2 textCoord,Point3 tangent,Point3 biNormal);

	void BeginWriteIndices(void);
	void EndWriteIndices(void);

	void WriteIndice(int ind);

	void BeginWriteMaps(void);
	void EndWriteMaps(void);

	void WriteMap(const char* mapType, const char* mapPath);

	void BeginWriteSkinInfo(void);
	void EndWriteSkinInfo(void);
	void BeginWriteBones(void);
	void EndWriteBones(void);


	void WriteBone(const char* parentName, std::vector<const char*> childsName, const char* boneName, std::vector<int> skinIndices,std::vector<float> skinWeights, Point3 translation,Point4 rotation, Point3 scale);
	
	void BeginWriteAnimationInfos(const char*  animationName);
	void EndWriteAnimationInfos();
	void WriteAnimationClip(const char* boneName , float time,Point3 translation,Point4 rotation, Point3 scale);
		

	void BeginWriteHelpers(void);
	void EndWriteHelpers(void);
	void WriteHelper(const char* Name,Point3 translation,Point4 rotation, Point3 scale );

	void BeginWriteCameras(void);
	void EndWriteCameras(void);
	void WriteCamera(const char* nome,float nearPlane, float farPlane, float fov, Point3 Position, Point3 Target);

private:
	ofstream output;
	void writePoint(Point3 pt);
	void writePoint(Point4 pt);
	void writePoint(Point2 pt);
};
